package io.kubesphere.devops.dao;

import io.kubesphere.devops.model.UserMerging;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMergingDao {

    /**
     * user_merging_id
     * source_identification_id
     * target_identification_id
     * status
     *
     * @param log
     * @return
     */
    @Insert(
            "INSERT INTO user_merging (user_merging_id,source_identification_id, target_identification_id, status) VALUES (#{userMergingId}, #{sourceIdentificationId}, #{targetIdentificationId}, "
                    + "#{status})")
    Integer saveUserMergingLog(UserMerging log);

    @Select("SELECT user_merging_id userMergingId, source_identification_id sourceIdentificationId, target_identification_id targetIdentificationId, status status " +
            "FROM user_merging where user_merging_id = #{userMergingId}")
    UserMerging getById(String userMergingId);

    @Update("update user_merging set status = #{status} where user_merging_id = #{userMergingId}")
    void updateStatus(String userMergingId,String status);
}
